package com.sunxd.zstudy.java8.lambda;

import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author sun.xd
 * @description: description
 * @date 2023/11/14 16:56
 */
public class TPredicate {
    public static void main(String[] args) {
        // 匿名内部类的实现
        Predicate<String> predicate = new Predicate<String>() {
            @Override
            public boolean test(String s) {
                if(s.length() > 1) return Boolean.TRUE;
                return Boolean.FALSE;
            }
        };
        System.out.println(predicate.test("1"));
        System.out.println(predicate.test("12"));

        Predicate<String> predicate1 = (x) -> {
            if(x.length() > 1) return Boolean.TRUE;
            return Boolean.FALSE;
        };
        System.out.println(predicate1.test("1"));
        System.out.println(predicate1.test("12"));


    }
}
